{% import _self as tree %}

{% macro render(taxons) %}
    {% import _self as tree %}

    {% for taxon in taxons %}
        <div class="item">
            <i class="folder icon"></i>
            <div class="content">
                <div class="header">
                    <a href="{{ path('sylius_admin_product_per_taxon_index', {'taxonId': taxon.id}) }}">
                        {{ taxon.name }}
                    </a>
                </div>
                <div class="list">
                    {{ tree.render(taxon.children) }}
                </div>
            </div>
        </div>
    {% endfor %}
{% endmacro %}

<div class="ui large fluid vertical buttons">
    <a href="{{ path('sylius_admin_product_index') }}" class="ui primary labeled icon button">
        <i class="search icon"></i>
        {{ 'sylius.ui.browse_all_products'|trans }}
    </a>
    <a href="{{ path('sylius_admin_taxon_create') }}" class="ui labeled icon button">
        <i class="sitemap icon"></i>
        {{ 'sylius.ui.manage_taxons'|trans }}
    </a>
</div>

<div class="ui segment">
    <div class="ui list">
        {{ tree.render(taxons) }}
    </div>
</div>
